package com.hzhq.contract.repo;

import com.hzhq.contract.bean.entity.Company;
import com.hzhq.contract.bean.entity.Role;
import org.bson.types.ObjectId;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.stereotype.Repository;


import java.util.List;
import java.util.Optional;

/**
 * @author hzhq
 * @create 2021/4/8 11:36 下午
 * @email hzhq1255@163.com
 */
@Repository
public interface CompanyRepository extends MongoRepository<Company, ObjectId> {

    Optional<Company> findByCompanyIdAndDeleted(ObjectId companyId, Integer deleted);

    Optional<Company> findByCompanyNameAndDeleted(String companyName, Integer deleted);

    List<Company> findByDeleted(Integer deleted);

    Page<Company> findByDeleted(Integer deleted, Pageable pageable);

    List<Company> findByDeletedAndCompanyIdIn(Integer deleted, List<ObjectId> companyIds);
}
